package com.tbvtc.agriculturalcreditchainserver2025.controller.admin;

import com.tbvtc.agriculturalcreditchainserver2025.service.LogisticsService;
import com.tbvtc.agriculturalcreditchainserver2025.utils.RUtils;
import com.tbvtc.agriculturalcreditchainserver2025.utils.Result;
import com.tbvtc.agriculturalcreditchainserver2025.vo.LogisticsVo.updateLogisticsInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.fisco.bcos.sdk.transaction.model.dto.TransactionResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/logistics")
@Tag(name = "物流")
public class LogisticsController {
    // 更新物流信息

    @Autowired
    private LogisticsService logisticsService;
    @Operation(summary = "更新物流信息")
    @PostMapping("/updateLogisticsInfo")
    public Result updateLogisticsInfo( @RequestBody updateLogisticsInfoVo updateLogisticsInfoVo ) throws Exception {
        TransactionResponse response = logisticsService.updateLogisticsInfo(updateLogisticsInfoVo);
        return RUtils.success(response);
    }
    @Operation(summary = "查看物流信息")
    @PostMapping("/logisticsInfo")
    public Result logisticsInfo( @Schema(description = "物流单号") Integer id) throws Exception {
        List list = logisticsService.logisticsInfo(id);
        return RUtils.success(list);
    }
}
